-
Notifications
You must be signed in to change notification settings - Fork 167
chore: Exclude more packages #950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
chore: Exclude more packages #950
Conversation
🦋 Changeset detectedLatest commit: cf8ce94 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
function isExcluded(srcPath: string) { | ||
return EXCLUDED_PACKAGES.some((excluded) => | ||
function isExcluded(srcPath: string): string | undefined { | ||
return EXCLUDED_PACKAGES.find((excluded) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use find here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same reason. I wanted to keep track of the packages that gets excluded. So we can logger.debug them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's useful at all, or at least i don't see how. I'd rather have this documented in the docs
@@ -250,11 +254,17 @@ File ${serverPath} does not exist | |||
|
|||
// Only files that are actually copied | |||
const tracedFiles: string[] = []; | |||
|
|||
// Packages that are excluded and not copied | |||
const excludedPackages = new Set<string>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a Set here ?
// We don't want to copy excluded packages (e.g. sharp) | ||
const excluded = isExcluded(from); | ||
if (excluded) { | ||
if (excluded && !excludedPackages.has(excluded)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't understand the logic. What was the issue with the isExcluded from before ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wanted to add a debug for the packages that actually gets excluded.
Add more packages that can be excluded so they don't get copied into the final bundles
node_modules
. Also add debug to determine which packages actually gets skipped. I've run the E2E successfully. These packages will be skipped now:typescript
next/dist/compiled/babel
next/dist/compiled/babel-packages
next/dist/compiled/amphtml-validator
It will decrease the unzipped folder by 15mb and the zipped one with 4mb: